package com.hghivln.blog.common.exception;

import com.hghivln.blog.common.lang.ResultEnum;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
public class BlogException extends RuntimeException{

    /**
     * 错误状态码
     */
    private Integer errorCode = ResultEnum.ERROR.getCode();

    public BlogException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.errorCode = resultEnum.getCode();
    }

    public BlogException(Integer errorCode) {
        super();
        this.errorCode = errorCode;
    }

    public BlogException(String message) {
        super(message);
    }

    public BlogException(String message,Integer errorCode) {
        super(message);
        this.errorCode =errorCode;
    }

    public BlogException(String message, Throwable cause) {
        super(message, cause);
    }

    public BlogException(Throwable cause) {
        super(cause);
    }

    public BlogException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}
